//将身份转化为中文显示
export function parseRole(role: string | null) {
    if (role === 'MANAGER') {
        return "管理员"
    } else if (role === 'CUSTOMER') {
        return "顾客"
    } else if (role === 'STAFF') {
        return "工作人员"
    } else if (role === 'CEO') {
        return "CEO"
    }
}


export function parseCategory(category : string){
    if(category === 'FOOD') return "食物"
    else if(category === 'CLOTHES') return "服饰"
    else if(category === 'FURNITURE') return "家具"
    else if(category === 'ELECTRONICS') return "电子产品"
    else if(category === 'ENTERTAINMENT') return "娱乐"
    else if(category === 'SPORTS') return "体育产品"
    else if(category === 'LUXURY') return "奢侈品"
}

export function parseStatus(status : string){
    if(status === 'UNPAID'){
        return "待支付"
    }
    else if(status === 'UNSEND'){
        return "待发货"
    }
    else if(status === 'UNGET'){
        return "待收货"
    }
    else if(status === 'UNCOMMENT'){
        return "待评价"
    }
    else if(status === 'DONE'){
        return "已完成"
    }
    else{
        return "已取消"
    }
}

export function parseDelivery(method : string){
    if(method === 'DELIVERY'){
        return "快递送达"
    }
    else if(method === 'PICKUP'){
        return "到店自提"
    }
}
//将时间转化为日常方式
export function parseTime(time: string) {
    let times = time.split(/T|\./)
    return times[0] + " " + times[1]
}

export function parseCouponCategory(category : string){
    if(category === 'FULL_REDUCTION'){
        return "满减券"
    }
    else if(category === 'SPECIAL'){
        return "蓝鲸券"
    }
    else{
        return "无门槛券"
    }
}

export function parseCouponStatus(status : string){
    if(status === 'REMAINING'){
        return "未领取完"
    }
    else if(status === 'NOT_REMAINING'){
        return "已领完"
    }
}
